﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using TTTTBHYT.DAO;
using TTTTBHYT.VO;

namespace TTTTBHYT.BUS
{
    class Mau29DetailBUS
    {
        private Mau29DetailDAO mau29DetailDAO;
        public Mau29DetailBUS()
        {
            mau29DetailDAO = new Mau29DetailDAO();
        }
        private void GetMau29Detail(MAU29DETAILVO Mau29DetailVO, DataRow dr)
        {
            Mau29DetailVO.KeySL = dr["KEYSL"].ToString();
            Mau29DetailVO.KeyGH = dr["KeyGH"].ToString();
            Mau29DetailVO.Ngay = Convert.ToString(dr["Ngay"]);
            Mau29DetailVO.TienChiPhi = Convert.ToInt32(dr["TienChiPhi"]);
            Mau29DetailVO.TienKCB = Convert.ToInt32(dr["TienKCB"]);
            Mau29DetailVO.LyDo  = Convert.ToString(dr["LyDo"]);
            Mau29DetailVO.KetLuan = Convert.ToString(dr["KetLuan"]);

        }
        public List<MAU29DETAILVO> GetListMau29Detail(string KeyGH)
        {
            List<MAU29DETAILVO> lstMau29Detail = new List<MAU29DETAILVO>();
            MAU29DETAILVO Mau29DetailVO;
            DataTable dataTable = new DataTable();
            dataTable = mau29DetailDAO.SearchBySoKCB(KeyGH);
            foreach (DataRow dr in dataTable.Rows)
            {
                Mau29DetailVO = new MAU29DETAILVO();
                GetMau29Detail(Mau29DetailVO, dr);
                lstMau29Detail.Add(Mau29DetailVO);
            }
            return lstMau29Detail;
        }
        public MAU29DETAILVO InsertRecord(MAU29DETAILVO Mau29DetailVO)
        {
     
            return mau29DetailDAO.InsertRecord(Mau29DetailVO);
        }
        public bool DeleteRecord(string KeyGH)
        {
            return mau29DetailDAO.DeleteRecord(KeyGH);
        }
    }
}
